// Package categories 模型
package categories

import (
	"gohub/app/models"
	"gohub/pkg/database"
	"time"
)

type categories struct {
	models.BaseModel
	ID          uint64
	Name        string
	Description string
	CreatedAt   time.Time
	UpdatedAt   time.Time

	models.CommonTimestampsField
}

func (categories *categories) Create() {
	database.DB.Create(&categories)
}

func (categories *categories) Save() (rowsAffected int64) {
	result := database.DB.Save(&categories)
	return result.RowsAffected
}

func (categories *categories) Delete() (rowsAffected int64) {
	result := database.DB.Delete(&categories)
	return result.RowsAffected
}
